#ifndef IND_SHIMMING_ITEM_H
#define IND_SHIMMING_ITEM_H

#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
#include "shimming.h"

#define TRIANGLE_WIDTH 24

class IndShimmingItem : public QWidget
{
    Q_OBJECT
public:
    explicit IndShimmingItem(QWidget* parent = nullptr);
    char GetNodeNumber() { return m_nodeNumber; }
    void SetNodeNumber(char nodeNumber) { m_nodeNumber = nodeNumber; }
    void SetShowTriangle(bool showTriangle);
    void SetHighlight(bool highlight);
    void SetCount(int count) { m_cellCount = count; update(); }
    void SetRatio(int ratio) { m_cellRatio = ratio; update(); }
    static IndShimming::LoadType m_loadType;

protected:
    void paintEvent(QPaintEvent* event) override;
private:
    char m_nodeNumber { 0 };
    bool m_showTriangle { false };
    bool m_highlight { false };
    int m_cellCount { 0 };
    int m_cellRatio { 0 };

    void DrawRetangular(QPainter& painter);
    void DrawTriangle(QPainter& painter);
    void DrawCellCount(QPainter& painter);
};

#endif // IND_SHIMMING_ITEM_H
